package org.zjt.ds;

/**
 * @author juntao.zhang
 * @version V1.0
 * @Description: TODO
 * @Package org.zjt.link
 * @date 2018/4/22 13:06
 */
public class FPNum {

    public static Integer nums2(Integer arg) {
        if (arg == 0)
            return 0;

        return arg + nums2(arg -1);
    }

    public static Integer nums3(Integer arg) {
        if (arg == 1)
            return 1;

        return arg * nums3(arg -1);
    }

    public static Integer nums(Integer arg) {
        if (0==arg)
            return 0;
        if (1==arg)
            return 1;
        return nums(arg -1) + nums(arg -2);
    }

    public static void main(String[] args) {
        System.out.println(nums(6));
        System.out.println(nums2(6));
        System.out.println(nums3(6));
    }
}
